home *** CD-ROM | disk | FTP | other *** search
- #Editor Script to fix indentation.
- # (c) Solutionsoft, 1998
-
- #To use:
- #Choose Edit | Select ALL than run this editor script.
-
- # The current line is in $_.
-
- s/(^\ +\t*)(.)/$2/ ;
- s/(^\t+\ *)(.)/$2/ ;
-
-
- $prefix = "" ;
- foreach $i (1 .. $level){$prefix = $prefix."\t";}
-
- if (/\ *\{\ *$/)
- {
- $level++ ;
- }
-
- if (/^\ *\{\ *$/)
- {
- $level++ ;
- $prefix = $prefix."\t";
- }
-
-
- if (/\ *\}\ *$/)
- {
- $level-- ;
- }
-
- if (/\ *\}\ *\#.*/)
- {
- $level-- ;
- }
-
-
- if (/^\ *\}\ *$/)
- {
- $prefix = "" ;
- foreach $i (1 .. $level){$prefix = $prefix."\t";}
- $level-- ;
- }
-
- if (/^\ *\}\ *\#.*/)
- {
- $prefix = "" ;
- foreach $i (1 .. $level){$prefix = $prefix."\t";}
- $level-- ;
- }
-
-
-
- if ($level < 0) {$level = 0} ;
-
- $_ = $prefix.$_ ;
-
- #print the result,
- #which will replace the selected text in the IDE.
- print $_ ;
-
-
-